#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include "dialog_register.h"


#include <QCompleter>
#include <QStandardItemModel>


class HttpRequest;
class QCPItemTracer;
class QCPItemText;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

private:private:
    QCPItemTracer *tracer;
    QCPItemText *tracerLabel;
    bool m_alarm_flag;
    bool m_led_flag;
    bool m_fan_flag;
    bool m_lock_flag;


    bool m_isLogin;


    QTimer *m_timer, *timer;

    HttpRequest *m_http;
    //自动补全
    QStandardItemModel* m_Model ;
    QCompleter *m_completer;

//    Dialog_Register *dlg;

    QString recvStr ;
    int NormalGetRequest(QString paramer1, QString paramer2);

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();



    void init_curve();
    void realtimeDataShow();


signals:
    void loginRecv(bool,QString);

public slots:
    void onTimerTimeout();
    void onCheckBoxStateChanged(int state);
    void timerOut();
    void on_btn_getTH_allTime_clicked();

    void handleLoginCompleted(QString username);

    void mouseMove(QMouseEvent *e);//鼠标在曲线上移动时，显示具体值

    void do_show_user_info(QStringList user_info);

    void do_loginResponse(bool,QString);

    void do_UserInfoEntered(const QString &username, const QString &password, const QString &email);

    void do_UserInfoListEntered(QStringList info_list);

    void on_tB_home_clicked();

    void on_tB_control_clicked();

    void on_tB_query_clicked();

    void on_tB_monitor_clicked();

    void on_tB_set_clicked();

    void on_pB_login_clicked();

    void on_pB_register_clicked();

    void onEmailChoosed(const QString& email);
    void onTextChanged(const QString& str);

    void on_tb_query_data_clicked();

    void on_pb_alarm_clicked();

    void on_pb_led_clicked();

    void on_pb_fan_clicked();

    void on_pb_lock_clicked();

private slots:
    void on_action_triggered();

    void on_action_2_triggered();

    void on_action_3_triggered();

    void on_action_4_triggered();

    void on_action_5_triggered();



    void on_btn_getTH_clicked();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
